package com.teapos.enumtype;

public enum TeaTypeEnum {
	
	COMMON(1, "新茶老茶"),
	SAMPLE(2, "样茶"),
	DESSERT(3, "茶点"); 
	
	private int code;
	private String desc;
	private TeaTypeEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public static TeaTypeEnum getEnumByCode(int code) {
		TeaTypeEnum[] enums = TeaTypeEnum.values();
		for(TeaTypeEnum enumtype:enums) {
			if(enumtype.getCode()==code) return enumtype;
		}
		return null;
	}

}
